home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include <stdio.h>
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include "exinterfmotif.h"
- #include <string.h>
- #include "exglobals.h"
-
- extern Widget create_DupIcons();
- extern Widget create_AskDupIcons();
- Widget CreateGroup;
- Widget Index_w;
- Widget AskDupIcons_w;
- Widget DupIcons_w;
- Widget Quit_w;
-
- init_motif_interface(argc, argv)
- unsigned int argc;
- char **argv;
- {
- int i,j;
-
- /*------------------------------*/
- /* Initialize X */
- /*------------------------------*/
-
-
- UxDisplay = XtDisplay(DBtoplevel);
- UxScreen = XDefaultScreen(UxDisplay);
- XtVaSetValues(DBtoplevel,
- XtNx, 0,
- XtNy, 0,
- XtNwidth, DisplayWidth(UxDisplay, UxScreen),
- XtNheight, DisplayHeight(UxDisplay, UxScreen),
- NULL);
-
- MotifGroupWin = -1;
- MSwin = -1;
- InterfaceWinOpen = 0;
- DialogType = 0;
- WantToEnterFilesFlag = True;
-
- ExistKeywordString = (char *)malloc( sizeof(char) * 1024);
- ExistKeywordString[0] = '\0';
- ExistKeywordCount = 1;
- strcat(ExistKeywordString, "8 bit");
- GroupKeywordString = (char *)malloc( sizeof(char) * 512);
- GroupKeywordString[0] = '\0';
- DemoKeywordString = (char *)malloc( sizeof(char) * 512);
- DemoKeywordString[0] = '\0';
- ExeFileString = (char *)malloc( sizeof(char) * 512);
- ExeFileString[0] = '\0';
- GroupKeywordCount = 0;
- DemoKeywordCount = 0;
- ExeFileCount = 0;
-
- CreateGroup = create_CreateGroup();
- Index_w = create_Index();
- AskDupIcons_w = create_AskDupIcons();
- DupIcons_w = create_DupIcons();
- Quit_w = create_Quit();
- }
-
- Create_motif_widgets()
- {
-
- Widget sw;
-
- sw = create_AddDemo();
- sw = create_BookFile();
- sw = create_Message();
- sw = create_Question();
- }
-
- handleMotifInterfaceEvents()
- {
- XEvent event;
-
- while (XtAppPending(DBapp_context)) {
- XtAppNextEvent(DBapp_context, &event);
- XtDispatchEvent(&event);
- }
- }
-
- handleMessageEvents()
- {
- XEvent event;
-
- UxWaitForNotify();
- while (XtAppPending(DBapp_context)) {
- XtAppNextEvent(DBapp_context, &event);
- XtDispatchEvent(&event);
- }
- }
-
-
- #include <ctype.h>
- #include <X11/StringDefs.h>
- #include <Xm/Xm.h>
- #include <Xm/Text.h>
- #include <varargs.h>
-
- /* get normal string from XmString */
- char *extract_first_xms_segment(cs)
- XmString cs;
- {
- XmStringContext context;
- XmStringCharSet charset;
- XmStringDirection direction;
- Boolean separator;
- char *primitive_string;
-
- XmStringInitContext(&context,cs);
- XmStringGetNextSegment(context,&primitive_string,
- &charset,&direction,&separator);
- XmStringFreeContext(context);
- return(primitive_string);
- }
-
- /* find first normal string in XmString with a non-zero length */
- char *extract_nth_xms_segment(cs,seg_num)
- XmString cs;
- int seg_num;
- {
- XmStringContext context;
- XmStringCharSet charset;
- XmStringDirection direction;
- Boolean separator;
- char *primitive_string;
- int n;
-
- XmStringInitContext(&context,cs);
- n=0;
- do{
- XmStringGetNextSegment(context,&primitive_string,
- &charset,&direction,&separator);
- }
- while(n++<seg_num && primitive_string && !strlen(primitive_string));
- XmStringFreeContext(context);
- return(primitive_string);
- }
-
-
- #include <Xm/MwmUtil.h> /* mwm decoration */
-
- SetWMhints(wgt)
- Widget wgt;
- {
- MwmHints mwm_set_hints ;
- Atom mwm_hints ;
- XWMHints wm_set_hints;
- XUnmapEvent Unmap_ev;
-
- if (XmIsMotifWMRunning(wgt)) {
- mwm_hints = XmInternAtom(UxDisplay,
- "_MOTIF_WM_HINTS", False);
- mwm_set_hints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS ;
- mwm_set_hints.decorations =
- MWM_DECOR_ALL |
- MWM_DECOR_RESIZEH | MWM_DECOR_MENU |
- MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE ;
- mwm_set_hints.functions =
- MWM_FUNC_ALL |
- MWM_FUNC_CLOSE | MWM_FUNC_QUIT_APP |
- MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE ;
- XChangeProperty(UxDisplay,XtWindow(wgt),
- mwm_hints,mwm_hints,
- 32, PropModeReplace,
- (unsigned char *)&mwm_set_hints,
- sizeof(MwmHints)/sizeof(int));
- wm_set_hints.flags = StateHint;
- wm_set_hints.initial_state = NormalState;
- XSetWMHints(UxDisplay, XtWindow(wgt), &wm_set_hints);
- }
- }
-